﻿using System.Collections.Generic;
using System.Web.Services;
using ELearningSystem.Core.Interface;
using ELearningSystem.Core.Manager;
using ELearningSystem.DAO.DAO;

namespace ELearningSystem.Service
{
    /// <summary>
    /// Summary description for ContentService
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
        // [System.Web.Script.Services.ScriptService]
    public class ContentService : System.Web.Services.WebService, IContentManager
    {
        private IContentManager contentManager = new ContentManager();

        [WebMethod]
        public bool SaveOrUpdate(TreeContentDAO treeContent)
        {
            return contentManager.SaveOrUpdate(treeContent);
        }

        [WebMethod]
        public int GetLastPosition(TreeContentDAO parentNode)
        {
            return contentManager.GetLastPosition(parentNode);
        }

        [WebMethod]
        public TreeContentDAO GetCategoryNode()
        {
            return contentManager.GetCategoryNode();
        }
        
       
        [WebMethod]
        public List<TreeContentDAO> GetAllTopics()
        {
            return contentManager.GetAllTopics();
        }

        [WebMethod]
        public TreeContentDAO GetTreeContent(int id)
        {
            return contentManager.GetTreeContent(id);
        }

        [WebMethod]
        public string GetTreeDataSource()
        {
            return contentManager.GetTreeDataSource();
        }

        [WebMethod]
        public ContentDAO GetContent(int treeContentId)
        {
            return contentManager.GetContent(treeContentId);
        }

        [WebMethod]
        public bool IsMultipleAnswer(PracticeDAO practice, out string message)
        {
            return contentManager.IsMultipleAnswer(practice, out message);
        }

        [WebMethod]
        public string GetNextTreeNodePath(string treeNodeValue, string xmlData)
        {
            return contentManager.GetNextTreeNodePath(treeNodeValue, xmlData);
        }

        [WebMethod]
        public string GetPreviousTreeNodePath(string treeNodeValue, string xmlData)
        {
            return contentManager.GetPreviousTreeNodePath(treeNodeValue, xmlData);
        }
    }
}
